import request from '@/utils/http'


export const loginAPI = ({email,password})=>{
    let response = request({
        url:'/user/login',
        method:'POST',
        data:{
            email,
            password
        }
    });
    return response.then((result) => {
        console.log(result);
        return result;
      }).catch((err) => {
        console.error(err);
        return false;
      });
}

export const registAPI = ({rname,remail,rpassword,code})=>{
    console.log(rname,remail,rpassword,code)
    let name=rname;
    let email=remail;
    let password=rpassword;
    let response = request({
        url:'/user/register',
        method:'POST',
        data:{
            name,email,password,code
        }
    })
    return response.then((result)=>{
        console.log(result);
        return result;
      }).catch((err) => {
        console.error(err);
        return false;
    })
}

export const uppsdAPI = ({email,password,code})=>{
  
    return request({
        url:'/user/resetPwd',
        method:'POST',
        data:{
            email,password,code
        }
    }).then((result)=>{
        return result;
      }).catch((err) => {
        console.error(err);
        return false;
    })
}
export const getIdentifyAPI = ({email})=>{
   // let email=remail;
    console.log("getIdentifyAPI发送验证码"+email);
    request({
        url:'/getEmailCode',
        method:'POST',
        data:{
            email
        }
    }).then(console.log("已发送验证码"))
    
}


